﻿using Microsoft.Xna.Framework;
using GlobalGameClasses;
using DrawableObjects.Actors.Aircrafts;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;

namespace DrawableObjects.Actors.Projectiles
{
    public class HealingBeam : Projectile
    {
        /// <summary>
        /// this class creates healing beam as a weapon of the drone
        /// </summary>
        private HealingBeam(float speed, int baseDamage, string strTextureModel, Matrix worldMatrix, float scaleFactor, float boundingFactor, string explosionSound)
            : base(speed, baseDamage, strTextureModel, worldMatrix, scaleFactor, boundingFactor, explosionSound)
        {
            this.strTextureModel = strTextureModel;
        }

        public static HealingBeam GET_HEALING_BEAM_DRONE()
        {
            return new HealingBeam(5f, -2, "heal", Matrix.CreateWorld(new Vector3(0, GlobalGameValues.GAMEFIELD_HEIGHT, 0), Vector3.Backward, Vector3.Up), 1, 1, "missileExplosion");
        }

        /// <summary>
        /// heals the playeraircraft. these projectiles only collide with the playeraircraft for negative damage.
        /// </summary>
        public override void collide(Actor actor2)
        {
            if (actor2 is Aircraft) {
                Aircraft ac = (Aircraft)actor2;
                if (!ac.aircraftAttributes.Contains(Aircraft.AircraftAttributes.Transparent_Projectile)) {
                    world.removeActor(this);
                }
            }
        }

        public override Projectile Clone(Vector2 position, Vector2 direction)
        {
            Matrix newMatrix = this.worldMatrix;
            newMatrix.M41 = position.X;
            newMatrix.M43 = position.Y;
            HealingBeam cloned = new HealingBeam(this.speed, this.baseDamage, this.strTextureModel, newMatrix, this.scaleFactor, this.boundingSphereFactor, this.explosionSound);
            cloned.direction = direction;
            cloned.standardRotation = this.standardRotation;
            return cloned;
        }
    }
}

